/*
 * FPDFEMB_DRM1.h
 *
 *  Created on: 2009-12-16
 *      Author: Foxit BJ
 */

#ifndef FPDFEMB_DRM1_H_
#define FPDFEMB_DRM1_H_
#include "../fpdfemb.h"

/** @brief unknown DRM mode  	*/
#define FPDFDRMERR_SECURITY		20
/** @brief DRM check, mismatch   */
#define FPDFDRMERR_FOXITDRM		21


/**
 * Function: FPDFEMB_DRMStartLoadDRMDocument
 *			Start loading a PDF document with DRM
 *
 * Comments:
 *			Document loading is a progressive process. It might take a long time to
 *			load a document, especially when a file is corrupted, FPDFEMB will try to
 *			recover the document contents by scanning the whole file. If "pause" parameter
 *			is provided, this function may return FPDFERR_TOBECONTINUED any time during
 *			the document loading.
 *
 *			When FPDFERR_TOBECONTINUED is returned, the "document" parameter will
 *			still receive a valid document handle, however, no further operations can
 *			be performed on the document, except the "FPDFEMB_ContineLoadDocument" function
 *			call, which resume the document loading.
 *
 * @param[in] file			Pointer to file access structure.
 *							This structure must be kept valid as long as the document is open.
 * @param[in] password		Pointer to a zero-terminated byte string, for the password.
 *							Or NULL for no password.
 * @param[in] sn				Pointer to a zero-terminated byte string.
 								A Device Number to be used by FoxitDRM.
 							Or NULL for no Device Number.
 * @param[out] document		Receiving the document handle
 * @param[in] pause			A callback mechanism allowing the document loading process
 *							to be paused before it's finished. This can be NULL if you
 *							don't want to pause.
 *
 * @retval FPDFERR_SUCCESS				document successfully loaded.
 * @retval FPDFERR_TOBECONTINUED		The document loading can't be finished now.
 *										See comments below.
 * @retval FPDFERR_PASSWORD				incorrect password.
 * @retval FPDFERR_FORMAT				not a PDF or corrupted PDF.
 * @retval FPDFERR_SECURITY				encrypted by another way, not support.
 * @retval FPDFERR_DRM					this file can not be opened by [param sn]
 * @retval FPDFERR_FILE					file access error.
 * @retval FPDFERR_MEMORY				out of memory.
 */
FPDFEMB_RESULT FPDFEMB_DRMStartLoadDocument(struct FPDFEMB_FILE_ACCESS* file, const char* password, const char* sn,
									FPDFEMB_DOCUMENT* document, struct FPDFEMB_PAUSE* pause);

/**
 * Function: FPDFEMB_DRMCloseDocument
 *			Close a DRM PDF document and free all associated resources
 *
 * @param[in] document			Document handle
 * @return Error code. FPDFERR_SUCCESS for success.
 */
FPDFEMB_RESULT FPDFEMB_DRMCloseDocument(FPDFEMB_DOCUMENT document);

#endif /* FPDFEMB_DRM1_H_ */
